﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.TextFormatting;
using System.Windows.Documents;
using System.Windows;

namespace SmartPaginator.TextFormatting
{
    public class SmartTextParagraphProperties: TextParagraphProperties
    {
        #region Constructor

        public SmartTextParagraphProperties(Block element)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            _DefaultTextRunProperties = new SmartTextRunProperties(element);
            _FlowDirection = element.FlowDirection;
            _LineHeight = 0;
            _TextAlignment = element.TextAlignment;
            _FirstLineInParagraph = false;
        }

        public SmartTextParagraphProperties(FlowDocument document)
        {
            if (document == null)
                throw new ArgumentNullException("document");

            _DefaultTextRunProperties = new SmartTextRunProperties(document);
            _FlowDirection = FlowDirection.LeftToRight;
            _LineHeight = 0;
            _TextAlignment = document.TextAlignment;
            _FirstLineInParagraph = false;
        }

        #endregion

        #region Overriden Properties 

        public override TextRunProperties DefaultTextRunProperties
        {
            get { return _DefaultTextRunProperties; }
        }
        private TextRunProperties _DefaultTextRunProperties;

        public override bool FirstLineInParagraph 
        {
            get { return _FirstLineInParagraph; }
        }
        private bool _FirstLineInParagraph;

        public override FlowDirection FlowDirection
        {
            get { return _FlowDirection; }
        }
        private FlowDirection _FlowDirection;

        public override double Indent
        {
            get { return 0; }
        }

        public override double LineHeight 
        { 
            get { return _LineHeight; }  
        }
        private double _LineHeight;

        public override TextAlignment TextAlignment 
        { 
            get { return _TextAlignment; }
        }
        private TextAlignment _TextAlignment;

        public override TextMarkerProperties TextMarkerProperties
        {
            get { return null; }
        }

        public override TextWrapping TextWrapping
        {
            get { return TextWrapping.Wrap; }
        }

        #endregion
    }
}
